package com.beans;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;

import javax.xml.ws.Action;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: fzykd
 * Date: 2022-10-01
 * Time: 20:27
 */

@Controller
public class UserController3 {
    private UserService userService;

    //构造方法注入
    @Autowired
    public UserController3(UserService userService){
        //userService = new UserService(); 这是传统的写法
        this.userService = userService;
    }
    public void sayHi(){
        userService.sayHi();
    }
}
